package org.example.mallsystem1104.controller;

import org.example.mallsystem1104.common.Result;
import org.example.mallsystem1104.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/good")
@CrossOrigin
public class GoodController {

    @Autowired
    private GoodService goodService;


    @GetMapping
    public Result findAll(){
        return Result.success(goodService.findAll());
    }

    @GetMapping("/{id}")
    public Result findById(@PathVariable Long id){
        return Result.success(goodService.getGoodById(id));

    }

    @GetMapping("{/standard/{id}")
    public Result findStandardById(@PathVariable Long id){
        return Result.success(goodService.getStandardById(id));
    }



}
